# -*- coding: utf-8 -*-
import requests
import re
from bs4 import BeautifulSoup
pages_re = re.compile(u'(.*\u5c3e\u9875.*)', re.I)
url = 'http://tieba.baidu.com/f?kw=lovelivesunshine&ie=utf-8&pn=0'
r = requests.get(url, timeout=3)
soup = BeautifulSoup(r.content, 'html5lib')
author = soup.find("div", id="frs_list_pager")
question_links = soup.select('a[href]')
for link in question_links:
    title = link.text.strip() + '\n'
    if pages_re.match(title) is not None:
        my_text = re.findall('(\d\d+)', link['href'])
        print type(int(my_text[0].encode()))



